Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test gradedrange constructor with SectorProduct passed as NamedTuple #10

Merged
merged 3 commits into from
Feb 13, 2025

Conversation

ogauthe
Copy link
Collaborator

@ogauthe ogauthe commented Feb 12, 2025

Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.33%. Comparing base (ce027fd) to head (b3249c5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #10   +/-   ##
=======================================
  Coverage   83.33%   83.33%           
=======================================
  Files          13       13           
  Lines         414      414           
=======================================
  Hits          345      345           
  Misses         69       69           
Flag Coverage Δ
docs 0.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mtfishman
Copy link
Member

Thanks @ogauthe. Another way I could picture designing this would be making this gradedrange constructor in GradedUnitRanges.jl: https://github.com/ITensor/GradedUnitRanges.jl/blob/dedd27a2a5c560f4bb0156b0347679f654a224e6/src/gradedunitrange.jl#L95-L99 more generic, for example:

function gradedrange(lblocklengths::AbstractVector{<:LabelledInteger})
  brange = blockedrange(unlabel.(lblocklengths))
  lblocklasts = labelled.(blocklasts(brange), to_sector.(label.(lblocklengths)))
  return GradedOneTo(lblocklasts)
end

to_sector(x) = x

and then GradedUnitRanges.jl could have a package extension GradedUnitRangesSymmetrySectorsExt that overloads to_sector:

module GradedUnitRangesSymmetrySectorsExt

using GradedUnitRanges: GradedUnitRanges
using SymmetrySectors: SectorProduct

GradedUnitRanges.to_sector(nt::NamedTuple) = SectorProduct(nt)

end

That would be more generalizable and a bit simpler since it just keeps a single gradedrange constructor.

@mtfishman mtfishman closed this Feb 13, 2025
@mtfishman mtfishman reopened this Feb 13, 2025
@mtfishman
Copy link
Member

(Closed and reopened to retrigger the tests now that ITensor/GradedUnitRanges.jl#17 is merged.)

@mtfishman mtfishman changed the title gradedrange to convert NamedTuple Test gradedrange constructor with SectorProduct passed as NamedTuple Feb 13, 2025
@mtfishman mtfishman merged commit 5eeaf22 into ITensor:main Feb 13, 2025
14 of 20 checks passed
@ogauthe ogauthe deleted the gradedrange branch February 13, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Support gradedrange([(Nf=U1(0),) => 2, (Nf=U1(1),) => 3])
2 participants